﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Tos2Google
{
    public class Bar
    {
        public float Close { get; set; }
        public float High { get; set; }
        public float Low { get; set; }
        public float Open { get; set; }
        public float Volume { get; set; } // in 100's
        public DateTime? Timestamp { get; set; }
        public int? Sequence { get; set; }

        public DateTime StartTime { get; set; }
        //public DateTime EndTime { get; set; }

        //public string Label { get; set; }

        /// <summary>
        /// needed for the data returned by PriceHistory, which has no Sequence field
        /// </summary>
        internal void SequenceFromTimestamp()
        {
            if (!Sequence.HasValue && Timestamp.HasValue)
                Sequence = (int)Timestamp.Value.AddHours(-13).AddMinutes(-30).TimeOfDay.TotalMinutes;
        }

        /*public void LabelFromStartTime()
        {
            Label = string.Format("{0:HH:mm}", StartTime);

            //var daysBack = (int)(DateTime.Today - new DateTime(StartTime.Year, StartTime.Month, StartTime.Day)).TotalDays;
            //Label = string.Format("{0:HH:mm}", StartTime)
            //    + (daysBack == 0 ? string.Empty : "(-" + daysBack.ToString() + ")");
        }*/
    }
}
